
//
//  UIImage+color.swift
//  Exchange
//
//  Created by rui on 2018/4/24.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

extension UIImage {
    class func image(color: UIColor) -> UIImage? {
        let rect = CGRect(x: 0.0, y: 0.0, width: 1.0, height: 1.0)
        UIGraphicsBeginImageContext(rect.size);
        let context = UIGraphicsGetCurrentContext();
        context?.setFillColor(color.cgColor)
        context?.fill(rect)
        let image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext()
        return image
    }
}
